05. Exercise: Test Doubles

Exercise: Test Doubles

Create a Fake API Client

Task Description:

The starter code for this project contains a class called TimeZoneService uses a class called WorldTimeApiHttpClient to call the http://worldtimeapi.org/ Time API. We don't want to actually call this API for our unit tests, so your task is to make a Fake WorldTimeClient to use for testing. You should refactor the application to use an interface for the WorldTimeClient and then create a Fake that you can use for testing. Then write a unit test for the getAvailableTimezoneText method. Your unit test should verify that, if the WorldTimeClient returns a list of countries, the getAvailableTimezoneText response includes those countries in its return string.

Task List:

Task Feedback:

Great job!